package com.qms.tubu.decoration;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by Mad on 2015/7/17.
 */
public class RecommendDecoration extends RecyclerView.ItemDecoration{
    private int space;
    public RecommendDecoration() {
        space=0;
    }
    public RecommendDecoration(int space)
    {
        this.space=space;
    }
    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        outRect.top=0;
        outRect.left=0;
        if(parent.getChildAdapterPosition(view)==parent.getAdapter().getItemCount()-1)
            outRect.bottom=0;
        else
            outRect.bottom=space;
        outRect.right=0;
    }
}
